package Text2;

import java.util.*;

public class Main {
    static int N = 10010;
    static int[] b = new int[N];
    static boolean[] st = new boolean[N];

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        for (int i = 1; i <= n; i++) {
            b[i] = in.nextInt();
        }
        int cnt = 0;
        for (int i = 1; i <= n; i++) {
            if (!st[i]) {
                cnt++;
                for (int j = i; !st[j]; j = b[j]) {
                    st[j] = true;
                }
            }
        }
        System.out.println(n - cnt);
    }
}
